package com.servlet;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.logging.log4j.core.util.Assert;

import com.easywan.utils.Config;



public class ImageUrlGet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
    	try {
			String uuid = request.getParameter("uuid");
			System.out.println("imageGet:"+uuid);
			Thread.sleep(3000);
			for(int i = 0; i < 20; i ++){
				HashMap<String,String> hashMap = Config.uuidMap;
				if(Config.uuidMap.get(uuid) != null){
					try {
						response.getWriter().write(Config.uuidMap.get(uuid));
						return;
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
				Thread.yield();  
				try {
					Thread.sleep(500);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}
    }

   
    

}